/*
 * sdmmc_stack.h
 *
 *  Created on: Oct 16, 2013
 *      Author: Ken Arok
 */

#ifndef SDMMC_STACK_H_
#define SDMMC_STACK_H_

#include "storage.h"


/** \brief Test SD/MMC card unit ready ot not.
 *
 * \return Status.
 */
extern storage_status_t vSDMMC_TestUnitReady(void);

/** \brief Read capacity of card.
 *
 * \param _nb_sector Pointer to store number of sector.
 *
 * \return Status.
 */
extern storage_status_t vSDMMC_ReadCapacity(uint32_t *_nb_sector);

/** \brief Check weather card is write protected or not.
 *
 * \return true	if it is write protected. Otherwise false.
 */
extern bool vSDMMC_IsWriteProtected(void);

/** \brief Check weather card is removal or not.
 *
 * \return true	if it is removal. Otherwise false.
 */
extern bool vSDMMC_IsRemoval(void);

#if ACCESS_USB == true

/** \brief USB Read memory storage.
 *
 * \param _addr 		Address of memory.
 * \param _nb_sector	Number of sector.
 *
 * \return Status.
 */
extern storage_status_t vSDMMC_USBRead(uint32_t _addr, uint16_t _nb_sector);

/** \brief USB Write memory storage.
 *
 * \param _addr 		Address of memory.
 * \param _nb_sector	Number of sector.
 *
 * \return Status.
 */
extern storage_status_t vSDMMC_USBWrite(uint32_t _addr, uint16_t _nb_sector);

#endif /* ACCESS_USB */


#if ACCESS_MEM_TO_RAM == true

/** \brief Memory to RAM interface.
 *
 * \param _addr		Address of memory.
 * \param _ram		Pointer of RAM.
 *
 * \return Status.
 */
extern storage_status_t vSDMMC_MemoryToRAM(uint32_t _addr, void *_ram);


/** \brief RAM to Memory interface.
 *
 * \param _addr		Address of memory.
 * \param _ram		Pointer of RAM.
 *
 * \return Status.
 */
extern storage_status_t vSDMMC_RAMToMemory(uint32_t _addr, const void *_ram);

#endif /* ACCESS_MEM_TO_RAM */

#endif /* SDMMC_STACK_H_ */
